import React, { Component } from 'react';
import { index_banner } from "../../utils/api";
import { Swiper } from 'antd-mobile'
class mySwiper extends Component {
    state = {
        swiptlist: []
    }
    componentDidMount() {
        index_banner().then((res) => {
            if (res.data.code == 200) {
                this.setState({
                    swiptlist: res.data.list
                })
            }
        })
    }
    render() {
        return (
            <div className="swiper">
                <Swiper loop>
                    {
                        this.state.swiptlist.map((item, index) => (
                            <Swiper.Item key={index}>
                                <img src={item.pic} alt={item.name} />
                            </Swiper.Item>
                        ))
                    }
                </Swiper>
            </div>
        );
    }
}

export default mySwiper;